package com.tanfuqi.sicent.server.controller

import com.tanfuqi.sicent.protocol.message.Flow
import com.tanfuqi.sicent.protocol.message.Message
import com.tanfuqi.sicent.server.filter.sent
import io.swagger.annotations.ApiOperation
import org.springframework.web.bind.annotation.GetMapping
import org.springframework.web.bind.annotation.PathVariable
import org.springframework.web.bind.annotation.RestController
import reactor.core.publisher.Mono
@RestController
class FlowController :BaseController(){

    @ApiOperation(value = "查询用户流水")
    @GetMapping("/shop/{shopId}/member/{cardId}/flow/{type}/from/{from}/to/{to}")
    fun flow(@PathVariable shopId: String, @PathVariable cardId: String, @PathVariable type: Int, @PathVariable from: Int, @PathVariable to: Int): Mono<Any> =
            session(shopId).sent(Message(0x800D, body = Flow(cardId, type, from, to))).map { it.body }

}